package teacher.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import teacher.bean.Award;
import teacher.bean.Flow;
import teacher.bean.Patent;
import teacher.service.flow;
import teacher.service.patent;

import com.opensymphony.xwork2.ActionSupport;

public class modifyPat extends ActionSupport{
	private Patent pat;
	private int patentId;

	public Patent getPat() {
		return pat;
	}

	public void setPat(Patent pat) {
		this.pat = pat;
	}

	public int getPatentId() {
		return patentId;
	}

	public void setPatentId(int patentId) {
		this.patentId = patentId;
	}

	public String execute(){
		
		pat=new patent().selectPatentById(patentId);
//		流程管理部分
		Patent a=new Patent();
		a=new flow().selectPatentByName(this.getPat().getName());
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getPatId());
		f.setFruitKind(0);
		f.setDirDo(2);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(3);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return SUCCESS;
		}else{
			return SUCCESS;
		}
		
	} 

}
